<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  .father1{
    /* width: 600px;
    height: 600px; */
    background-color: aquamarine;
    margin: 0 auto;
    overflow: hidden;
  }
  .father2{
    /* width: 600px;
    height: 600px; */
    background-color: aquamarine;
    margin: 0 auto;
    display: inline-block;
  }
  .father3{
    /* width: 600px;
    height: 600px; */
    background-color: aquamarine;
    margin: 0 auto;
    display: flex;
  }
  .son1{
    width: 200px;
    height: 200px;
    background-color: aqua;
    float: left;
  }
  .son2{
    width: 200px;
    height: 200px;
    background-color: blueviolet;
    float: right;
  }
  .son3{
    width: 200px;
    height: 200px;
    background-color: pink;
  }
</style>
<body>
  <h3>BFC的作用？</h3>
  <div>1.防止浮动元素被覆盖</div>
  <div>2.解决高度塌陷问题（比如：一个容器内有两个div是浮动元素，此时父元素没有设置高度，我们给父元素设置一个背景色，这时候发现没有任何效果,因为父元素此时高度为0，这是我们就可以添加一个触发父元素BFC功能的属性。因为BFC有个功能是计算高度时，浮动元素也会参与计算。</div>
  <div>3.可以解决两个相邻盒子的margin边距重叠的问题。</div>
  <div>overflow: hidden;</div> 
  <div class="father1">
    <div class="son1"></div>
    <div class="son2"></div>
  </div>
  <div class="son3"></div>

  <div>display: inline-block;</div>
  <div class="father2">
    <div class="son1"></div>
    <div class="son2"></div>
  </div>
  <div class="son3"></div>

  <div>display: flex;</div>
  <div class="father3">
    <div class="son1"></div>
    <div class="son2"></div>
  </div>
  <div class="son3"></div>
</body>
</html>